package liangtWorkSpace.validation.base;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.groups.Default;

/**
 * @ClassName GroupTestController
 * @Description : 分级联合校验
 * @Author : LiangT
 * @Date : 2020/4/24 16:41
 */
@RestController
public class GroupTestController {

    @PostMapping(value = "/group/test/one")
    public String testOne(@Validated(value = Create.class) @RequestBody GroupStudent student){
        return " Group-test-testOne pass";
    }

    @PostMapping(value = "/group/test/tow")
    public String testTow(@Validated(value = Update.class) @RequestBody GroupStudent student){
        return " Group-test-testTow pass";
    }

    @PostMapping(value = "/group/test/three")
    public String testThree(@Validated(value = {Create.class,Update.class}) @RequestBody GroupStudent student){
        return " Group-test-testThree pass";
    }

    @PostMapping(value = "/group/test/four")
    public String testFour(@Validated(value = Default.class) @RequestBody GroupStudent student){
        return " Group-test-testFour pass";
    }

    @PostMapping(value = "/group/test/five")
    public String testFive(@Validated @RequestBody GroupStudent student){
        return " Group-test-testFive pass";
    }
}
